{__NOLAYOUT__}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>{$seo_title}</title>
    <include file="Index:meta" />
    <!-- ZUI1.7.0 -->
    <link href="https:__PUBLIC__/dist/css/zui.min.css" rel="stylesheet">
    <!-- Swiper -->
    <link href="__PUBLIC__/dist/css/swiper.min.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/main.css" rel="stylesheet">
    <style>
        .modal-body {
            white-space: pre-wrap;
            line-height: 1.5;
        }
    </style>
</head>

<body>
    <i class="goTop"></i>
    <div id="page">
        <!--<a class="goTop"></a>-->
        <!-- header -->
        <include file="Index:header" />
        <!-- header end -->
        <section class="banner">
            <div class="tab-inner container">
                <ul class="tab">
                    <li>
                        <h1>全部专业</h1>
                    </li>
                    <foreach name="data" item="vo">
                        <li>
                            <a href="index.php?m=Index&a=major&pid={$vo.id.val}">{$vo.title.val}</a>
                            <notempty name="vo.gwlist">
                                <div class="tab-con">

                                    <div class="link">

                                        <foreach name="vo.gwlist" item="vg">
                                            <div class="tab-con-line clearfix">
                                                <h2>
                                                    <a href="index.php?m=Index&a=major&pid={$vo.id.val}&cid={$vg.id.val}">
                                                        {$vg.title.val}
                                                    </a>
                                                </h2>
                                                <div>
                                                    <foreach name="vg.xmlist" item="vx">
                                                        <a href="index.php?m=Index&a=details&pid={$vo.id.val}&cid={$vg.id.val}&oid={$vx.id.val}">
                                                            {$vx.title.val}
                                                        </a>
                                                    </foreach>

                                                </div>
                                            </div>
                                        </foreach>
                                    </div>
                                    <!-- <div class="txt pull-left">
                                        <h2 class="bold text-center mb-10">{$vo.title.val}</h2>
                                        <p>{$vo.description.val}</p>
                                    </div> -->
                                </div>
                            </notempty>
                        </li>
                    </foreach>
                </ul>
            </div>
            <!-- Swiper -->
            <div class="swiper-container">
                <div class="swiper-wrapper">
                    <!-- 幻灯片 -->
                    <foreach name="hdp" item="vo">
                        <div class="swiper-slide" style="background-image:url({$vo.pic})">
                            <a href="{$vo.link}"></a>
                        </div>
                    </foreach>
                    <!-- 幻灯片 end -->

                </div>
                <!-- Add Pagination -->
                <div class="swiper-pagination"></div>
            </div>
        </section>
        <!-- 专业 cell -->
        <foreach name="data" item="vo" key="ko">

            <section class="project" id="jsj{$ko}" data-index="{$ko}" data-id="{$vo.id.val}">
                <div class="container">
                    <!-- 头部 -->
                    <div class="project_title mb-10">
                        <h1>
                            {$vo.title.val}
                            <a class="pull-right btn btn-primary" href="index.php?m=Index&a=major&pid={$vo.id.val}">
                                专业详情
                            </a>
                        </h1>
                    </div>
                    <hr>
                    <!-- 类别 -->
                    <div class="project_class mb-20">
                        <!-- 专业 nav -->
                        <foreach name="vo.gwlist" item="vg" key="kg">
                            <a class="{$kg === 0?'active':''}" data-index="{$kg}" data-id="{$vg.id.val}">
                                {$vg.title.val}
                            </a>
                        </foreach>
                        <!-- 专业 nav end -->
                    </div>
                    <!-- 简介 -->
                    <div class="project_head clearfix mb-20"></div>
                    <!-- 内容 -->
                    <div class="project_card flex row"></div>
                </div>
            </section>

        </foreach>
        <!-- 专业 cell end-->


        <include file="Index:footer" />

    </div>

    <div class="modal modal-for-page  fade" id="myModal">
        <div class="modal-dialog modal-lg">
            <div class="modal-header ">
                <button type="button" class="close" data-dismiss="modal">
                    <span aria-hidden="true">×</span>
                    <span class="sr-only">关闭</span>
                </button>
                <h1 class="modal-title">&nbsp;</h1>
            </div>
            <div class="modal-content">
                <div class="modal-body"> </div>
            </div>
        </div>
    </div>
    <script src="__PUBLIC__/dist/js/jquery.min.js"></script>
    <script src="__PUBLIC__/dist/js/zui.min.js"></script>
    <script src="__PUBLIC__/dist/js/swiper.min.js"></script>
    <script src="__PUBLIC__/dist/js/jquery.qrcode.min.js"></script>
    <script src="__PUBLIC__/dist/js/main.js"></script>
    <script>
        $(function () {
            var www = window.location.host;

            var swiper = new Swiper('.swiper-container', {
                autoplay: 3000, //可选选项，自动滑动
                pagination: '.swiper-pagination',
                paginationClickable: true,
            })

            var menujson = {$menu};
            //点击切换岗位
            $(".project_class a").on("click", menuqie);
            //默认触发第一个

            var os = document.querySelectorAll(".project_class");

            for (var i = 0; i < os.length; i++) {
                var o = os[i].querySelector('a.active');
                if (o) o.click();
            }


            ///o this a岗位id b专业id
            function menuqie() {
                if (!menujson) return;
                var $o = $(this);
                var index = $o.index();
                //专业
                var $p = $o.parents(".project");
                //专业id
                var pindex = $p.data("index");
                var pid = $p.data("id");//实际专业id
                //当前岗位
                var cindex = $o.data("index");
                var cid = $o.data("id");//实际岗位id
                //当前岗位数据
                var data = menujson[pindex].gwlist[cindex];
                // console.log($p.data("index"), pindex, data)


                //top 容器
                var $top = $p.find(".project_head");
                //内容容器
                var $content = $p.find(".project_card");
                $o.addClass("active");
                $o.siblings("a").removeClass("active");

                // 项目导航
                var head_nav = "<div class=\"row\">"
                    + "    <div class=\"col-xs-2\">"
                    + "        <div>电子教材</div>"
                    + "        <div class=\"num\">"
                    + data.dzjcnum.val
                    + "        </div>"
                    + "    </div>"
                    + "    <div class=\"col-xs-2\">"
                    + "        <div>教学视频</div>"
                    + "        <div class=\"num\">"
                    + data.jxspnum.val
                    + "        </div>"
                    + "    </div>"
                    + "    <div class=\"col-xs-2\">"
                    + "        <div>微课课件</div>"
                    + "        <div class=\"num\">"
                    + data.wkkjnum.val
                    + "        </div>"
                    + "    </div>"
                    + "    <div class=\"col-xs-2\">"
                    + "        <div>电子教案</div>"
                    + "        <div class=\"num\" >"
                    + data.dzjanum.val
                    + "        </div>"
                    + "    </div>"
                    + "    <div class=\"col-xs-2\">"
                    + "        <div>电子课件</div>"
                    + "        <div class=\"num\">"
                    + data.qtkjnum.val
                    + "        </div>"
                    + "    </div>"
                    + "    <div class=\"col-xs-2\">"
                    + "        <div>教学素材</div>"
                    + "        <div class=\"num\">"
                    + data.jxscnum.val
                    + "        </div>"
                    + "    </div>"
                    + "</div>";

                var head = "<div class=\"bg col-md-9\" style=\"background-image:url(" + data.bigimage.val + ");\"></div>"
                    + "    <div class=\"col-md-3 photo text-center\">"
                    + "        <img src=\"" + data.bigimage.val + "\" >"
                    + "     </div>"
                    + "    <div class=\"col-md-6 content\">"
                    + "        <div class=\"clearfix \" style=\"margin-bottom:15px\">"
                    + "            <h4 class=\"pull-left\">"
                    + data.title.val
                    + "             </h4>"
                    + "            <a class=\"pull-right btn btn-success\" data-content=\"" + data.gwbz.val + "\">岗位标准</a>"
                    + "            <a class=\"pull-right btn btn-primary\" data-content=\"" + data.introduct.val + "\">岗位介绍</a>"
                    + "        </div>"
                    + "        <p class=\"text-primary\">"
                    + data.createtime.attr.name + "："
                    + (new Date(data.createtime.val * 1000).toLocaleDateString().replace('/', '-').replace('/', '-'))
                    + "        </p>"
                    + "        <p>建课人： " + data.bzry.val + "</p>"
                    + "        <p>项目数：" + data.xmlist.length + "任务数：" + data.rwsnum.val + "</p>"
                    + "        <hr>"
                    + head_nav
                    + "    </div>"
                    + "    <div class=\"col-md-3 qrcode\"></div>";
                //生成内容
                $top.html(head);
                var xm = data.xmlist;
                var con = "";
                if (xm) {
                    for (var k in xm) {
                        con += addXm(xm[k], pid, cid);
                    }
                }
                //生成qr
                $p.find(".qrcode").qrcode(www + 'index.php?m=Index&a=major&cid=' + data.id.val);
                $content.html(con);

            }
            //显示模拟框
            $("body").on("click", "[data-content]", function () {
                var content = $(this).data("content");
                if (!content) return;
                $("#myModal").modal("show");
                //内容
                var title = $(this).html();
                $(".modal-title").html(title);
                $("#myModal").find(".modal-body").html(content);
            })

            /**
            *生成项目项
            *@param {Object} d 数据
            *@param {number} p 专业id
            *@param {number} c 岗位id
            */
            function addXm(d, p, c) {

                var content =
                    "<a href=\"index.php?m=Index&a=details&pid=" + p + "&cid=" + c + "&oid=" + d.id.val + "\">"
                    + "   <div class=\"project_card_box\">"
                    + "        <div class=\"project_card_img mb-20\">"
                    + "            <img src=\""
                    + (d.bigimage.val ? d.bigimage.val : '__PUBLIC__/dist/image/xm1.jpg')
                    + "          \">"
                    + "        </div>"
                    + "        <div class=\"project_card_data\">"
                    + "            <p class=\"text-primary mb-10 text-ellipsis\">"
                    + d.xmid.val
                    + "            </p>"
                    + "            <h2 class=\"text-ellipsis\">" + d.title.val + "</h2>"
                    + "            <hr>"
                    + "            <div>"
                    + "                <span class=\"photo\">"
                    + "                    <img src=\"__PUBLIC__/dist/image/user.png\" />"
                    + "                </span>"
                    + "                <span>" + d.bzry.val + "</span>"
                    + "                <span class=\"text-right\">"
                    + (new Date(d.createtime.val * 1000).toLocaleDateString().replace('/', '-').replace('/', '-'))
                    + "                </span>"
                    + "            </div>"
                    + "        </div>"
                    + "    </div>"
                    + "</a>";
                return content;
            }
        })
    </script>
</body>

</html>